<?php

class Index{

	var $db;

	public function __construct(){
		$this->db = new DBClass();
	}
	public function get_news_bg(){

		$query = "Select * from post p LEFT JOIN log_activity_post lp ON p.id_post = lp.post_id_post LEFT JOIN user u ON lp.user_id_user = u.id_user LEFT JOIN kategori k ON p.kategori_id_kategori = k.id_kategori WHERE kategori_id_kategori=10 ORDER BY id_post DESC LIMIT 0,1";

		$rows = $this->db->getRows($query);

		return $rows;	

	}

	public function get_news_md(){

		$query = "Select * from post p LEFT JOIN log_activity_post lp ON p.id_post = lp.post_id_post LEFT JOIN user u ON lp.user_id_user = u.id_user LEFT JOIN kategori k ON p.kategori_id_kategori = k.id_kategori WHERE kategori_id_kategori=10 ORDER BY id_post DESC LIMIT 1,2";

		$rows = $this->db->getRows($query);

		return $rows;	

	}

	public function get_ent(){

		$query = "Select * from post p LEFT JOIN log_activity_post lp ON p.id_post = lp.post_id_post LEFT JOIN user u ON lp.user_id_user = u.id_user LEFT JOIN kategori k ON p.kategori_id_kategori = k.id_kategori WHERE kategori_id_kategori=9 ORDER BY id_post DESC LIMIT 0,4";

		$rows = $this->db->getRows($query);

		return $rows;	

	}

	public function get_lifestyle(){

		$query = "Select * from post p LEFT JOIN log_activity_post lp ON p.id_post = lp.post_id_post LEFT JOIN user u ON lp.user_id_user = u.id_user LEFT JOIN kategori k ON p.kategori_id_kategori = k.id_kategori WHERE kategori_id_kategori=3 ORDER BY id_post DESC LIMIT 0,4";

		$rows = $this->db->getRows($query);

		return $rows;	

	}

	public function get_event(){

		$query = "Select * from post p LEFT JOIN log_activity_post lp ON p.id_post = lp.post_id_post LEFT JOIN user u ON lp.user_id_user = u.id_user LEFT JOIN kategori k ON p.kategori_id_kategori = k.id_kategori WHERE kategori_id_kategori=11 ORDER BY id_post DESC LIMIT 0,4";

		$rows = $this->db->getRows($query);

		return $rows;	

	}

	public function get_fashion(){

		$query = "Select * from post p LEFT JOIN log_activity_post lp ON p.id_post = lp.post_id_post LEFT JOIN user u ON lp.user_id_user = u.id_user LEFT JOIN kategori k ON p.kategori_id_kategori = k.id_kategori WHERE kategori_id_kategori=5 ORDER BY id_post DESC LIMIT 0,4";

		$rows = $this->db->getRows($query);

		return $rows;	

	}

	public function get_culture(){

		$query = "Select * from post p LEFT JOIN log_activity_post lp ON p.id_post = lp.post_id_post LEFT JOIN user u ON lp.user_id_user = u.id_user LEFT JOIN kategori k ON p.kategori_id_kategori = k.id_kategori WHERE kategori_id_kategori=9 ORDER BY id_post DESC LIMIT 0,4";

		$rows = $this->db->getRows($query);

		return $rows;	

	}

	public function get_local(){

		$query = "Select * from post p LEFT JOIN log_activity_post lp ON p.id_post = lp.post_id_post LEFT JOIN user u ON lp.user_id_user = u.id_user LEFT JOIN kategori k ON p.kategori_id_kategori = k.id_kategori WHERE kategori_id_kategori=6 ORDER BY id_post DESC LIMIT 0,4";

		$rows = $this->db->getRows($query);

		return $rows;	

	}

	public function get_lol(){

		$query = "Select * from post p LEFT JOIN log_activity_post lp ON p.id_post = lp.post_id_post LEFT JOIN user u ON lp.user_id_user = u.id_user LEFT JOIN kategori k ON p.kategori_id_kategori = k.id_kategori WHERE kategori_id_kategori=8 ORDER BY id_post DESC LIMIT 0,4";

		$rows = $this->db->getRows($query);

		return $rows;	

	}
}